/* Copyright (c) 2008, dZettaApart.
   Licensed under the BSD License.
   See COPYING for details. */

#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>

#include <deque>
#include <iostream>

#include "memcacheasio.h"
#include "memcacheasio_p.h"

using namespace memcacheasio;
using namespace std;
using namespace boost;
using namespace boost::asio;
 
namespace memcacheasio
{
	/** **************************************************************************
	 * Memcacheasio::Memcacheasio
	 * 
	 ****************************************************************************/
	Memcacheasio::Memcacheasio ( )
	{
        _memcacheasio_p.reset( new Memcacheasio_p() );
	}

	/** **************************************************************************
	 * Memcacheasio::~Memcacheasio
	 * 
	 ****************************************************************************/
	Memcacheasio::~Memcacheasio()
	{
	}

	/** **************************************************************************
	 * Memcacheasio::Create
	 * 
	 ****************************************************************************/
	void Memcacheasio::init ( const std::string& host, const std::string& port, int count_connection, int count_thread, int tryCount, int tryTimeout, int limitConnection )
	{
		_memcacheasio_p->init ( host, port, count_connection, tryCount, tryTimeout, limitConnection );
	}

	/** **************************************************************************
	 * Memcacheasio::stop
	 * 
	 ****************************************************************************/
	void Memcacheasio::stop()
	{
		_memcacheasio_p->stop();
	}

	/** **************************************************************************
	 * Memcacheasio::execute
	 * 
	 * Add request to Memcacheasio obejct for processing
	 ****************************************************************************/
	void Memcacheasio::execute ( Request::Ptr request, boost::function1<void, Request::Ptr > cb )
	{
		_memcacheasio_p->execute ( request, cb );
	}

} //namespace memcacheasio

